Update dependencies.
all: gpsbabel
gpsbabel: $(OBJS)
- $(CC) $(CFLAGS) $(OBJS) -o gpsbabel -lexpat -lm #-lpdb
+ $(CC) $(CFLAGS) $(OBJS) -o gpsbabel -lexpat -lm
clean:
rm -f $(OBJS) gpsbabel gpsbabel.exe
cetus.o: cetus.c defs.h queue.h coldsync/palm.h coldsync/pdb.h
-csv.o: csv.c defs.h queue.h
+csv.o: csv.c defs.h queue.h csv_util.h
+csv_util.o: csv_util.c defs.h queue.h csv_util.h
+garmin.o: garmin.c defs.h queue.h jeeps/gps.h jeeps/gpsport.h \
+ jeeps/gpsserial.h jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h \
+ jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h \
+ jeeps/gpsmath.h jeeps/gpsnmea.h jeeps/gpsmem.h jeeps/gpsrqst.h \
+ jeeps/gpsinput.h jeeps/gpsproj.h jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h
geo.o: geo.c defs.h queue.h
gpsman.o: gpsman.c defs.h queue.h
gpspilot.o: gpspilot.c defs.h queue.h coldsync/palm.h coldsync/pdb.h
gpsutil.o: gpsutil.c defs.h queue.h magellan.h
gpx.o: gpx.c defs.h queue.h
+holux.o: holux.c defs.h queue.h holux.h
magnav.o: magnav.c defs.h queue.h coldsync/palm.h coldsync/pdb.h
magproto.o: magproto.c defs.h queue.h magellan.h
main.o: main.c defs.h queue.h
mapsend.o: mapsend.c defs.h queue.h mapsend.h
mapsource.o: mapsource.c defs.h queue.h
-mkshort.o: mkshort.c
+mkshort.o: mkshort.c defs.h queue.h
+mxf.o: mxf.c defs.h queue.h csv_util.h
+ozi.o: ozi.c defs.h queue.h csv_util.h
pcx.o: pcx.c defs.h queue.h
+psp.o: psp.c defs.h queue.h
queue.o: queue.c queue.h
route.o: route.c defs.h queue.h
tiger.o: tiger.c defs.h queue.h magellan.h
util.o: util.c defs.h queue.h
vecs.o: vecs.c defs.h queue.h
waypt.o: waypt.c defs.h queue.h
-psp.o: psp.c defs.h queue.h
-mxf.o: mxf.c csv_util.c defs.h queue.h csv_util.h
-ozi.o: ozi.c csv_util.c defs.h queue.h csv_util.h
-csv_util.o: csv_util.c csv_util.h defs.h
for(pdb_rec = pdb->rec_index.rec; pdb_rec; pdb_rec=pdb_rec->next) {
waypoint *wpt_tmp;
- wpt_tmp = calloc(sizeof(*wpt_tmp),1);
- if (wpt_tmp == NULL) {
- fatal(MYNAME ": cannot allocate memory\n");
- }
+ wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
rec = (struct record *) pdb_rec->data;
- wpt_tmp->shortname = strdup(rec->ID);
- wpt_tmp->description = strdup(rec->name);
+ wpt_tmp->shortname = xstrdup(rec->ID);
+ wpt_tmp->description = xstrdup(rec->name);
wpt_tmp->position.altitude.altitude_meters = pdb_read4(&rec->elevation) / 100.0;
wpt_tmp->position.longitude.degrees = pdb_read4(&rec->longitude) / 10000000.0;
static int ct;
struct tm *tm;
- rec = calloc(sizeof(*rec),1);
+ rec = xcalloc(sizeof(*rec),1);
strncpy(rec->ID, wpt->shortname, sizeof(rec->ID));
rec->ID[sizeof(rec->ID)-1] = 0;
* Turns out plain old strcmp will do the trick...
*/
- htable = malloc(ct * sizeof(*htable));
+ htable = xmalloc(ct * sizeof(*htable));
bh = htable;
- if (!htable) {
- fatal (MYNAME ":Cannot get array for sorting waypoints.");
- }
+
QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
waypointp = (waypoint *) elem;
bh->wpt = waypointp;
if (strlen(buff)) {
- wpt_tmp = calloc(sizeof(*wpt_tmp), 1);
- if (wpt_tmp == NULL) {
- fatal(MYNAME ": cannot allocate memory\n");
- }
+ wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
s = buff;
/* data delimited by commas, not enclosed */
wpt_tmp->position.longitude.degrees = atof(s);
break;
case 2:
- wpt_tmp->description = strdup(s);
- if (! wpt_tmp->description)
- fatal(MYNAME, ": cannot allocate memory\n");
+ wpt_tmp->description = xstrdup(s);
wpt_tmp->description = csv_stringtrim(wpt_tmp->description, " ");
break;
default:
}
/* allocate enough space for this data field */
- tmp = (char *) calloc((p - sp) + 1, sizeof(char));
-
- if (!tmp) {
- fatal(MYNAME ": cannot allocate memory\n");
- }
+ tmp = xcalloc((p - sp) + 1, sizeof(char));
strncpy(tmp, sp, (p - sp));
void fatal(const char *, ...);
ff_vecs_t *find_vec(char *);
void disp_vecs(void);
-
-
void printposn(coord *c, int is_lat);
+void *xcalloc(size_t nmemb, size_t size);
+void *xmalloc(size_t size);
+char * xstrdup(const char *s);
+
/*
* Data types for Palm/OS files.
*/
}
for (i = 0; i < n; i++) {
- waypoint *wpt_tmp = calloc(sizeof(*wpt_tmp),1);
+ waypoint *wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
wpt_tmp->shortname = way[i]->ident;
wpt_tmp->description = way[i]->cmnt;
extern queue waypt_head;
GPS_PWay *way;
+ way = xmalloc(n*sizeof(*way));
- if(!(way=(GPS_PWay *)malloc(n*sizeof(GPS_PWay *))))
- fatal(MYNAME ":not enough memory\n");
for (i = 0; i < n; i++) {
if(!((way)[i]=GPS_Way_New()))
fatal(MYNAME ":not enough memory\n");
const char **avp = &attrv[0];
while (*avp) {
if (strcmp(avp[0], "id") == 0) {
- wpt_tmp->shortname = strdup(avp[1]);
+ wpt_tmp->shortname = xstrdup(avp[1]);
}
avp+=2;
}
const char **avp = &attrv[0];
while (*avp) {
if (strcmp(avp[0], "text") == 0) {
- wpt_tmp->url_link_text = strdup(avp[1]);
+ wpt_tmp->url_link_text = xstrdup(avp[1]);
}
avp+=2;
}
}
if (strcmp(el, "waypoint") == 0) {
- wpt_tmp = calloc(sizeof(*wpt_tmp), 1);
+ wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
in_wpt++;
} else if (strcmp(el, "name") == 0) {
in_name++;
static void
geo_cdata(void *dta, const XML_Char *s, int len)
{
- char *foo = malloc(len+1);
+ char *foo = xmalloc(len+1);
foo[len] = 0;
strncpy(foo, s, len);
if (in_name) {
sscanf(ibuf, "%[^\t] %[^\t] %c%d %lf %c%d %lf",
sname, descr, &latdir, &latm, &latf, &londir, &lonm, &lonf);
- wpt_tmp = calloc(sizeof(*wpt_tmp),1);
-
- if (wpt_tmp == NULL) {
- fatal(MYNAME ": Cannot allocate enough memory\n");
- }
+ wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
lat = latm + latf;
lon = lonm + lonf;
wpt_tmp->position.longitude.degrees = lon;
wpt_tmp->position.latitude.degrees = lat;
- wpt_tmp->shortname = strdup(sname);
- wpt_tmp->description = strdup(descr);
+ wpt_tmp->shortname = xstrdup(sname);
+ wpt_tmp->description = xstrdup(descr);
waypt_add(wpt_tmp);
}
waypoint *wpt_tmp;
char *vdata;
- wpt_tmp = calloc(sizeof(*wpt_tmp),1);
- if (wpt_tmp == NULL) {
- fatal(MYNAME ": cannot allocate memory\n");
- }
+ wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
rec = (struct record *) pdb_rec->data;
wpt_tmp->position.longitude.degrees = pdb_read4(&rec->longitude) / 3.6e6;
* receiver) we use that for shortname and use 'name' as
* our description.
*/
- wpt_tmp->description = strdup(vdata);
+ wpt_tmp->description = xstrdup(vdata);
vdata = vdata + strlen(vdata) + 1;
vdata = vdata + strlen(vdata) + 1;
- wpt_tmp->shortname = strdup(vdata);
+ wpt_tmp->shortname = xstrdup(vdata);
waypt_add(wpt_tmp);
static int ct;
struct tm *tm;
- rec = calloc(sizeof(*rec),1);
+ rec = xcalloc(sizeof(*rec),1);
#if FIXME
strncpy(rec->ID, wpt->shortname, sizeof(rec->ID));
rec->ID[sizeof(rec->ID)-1] = 0;
while( fscanf(file_in, "%s %le%c %le%c %ld%c %30[^,] %c",
name, &lat, &latdir, &lon, &londir,
&alt, &alttype, desc, icon) > 0) {
- wpt_tmp = calloc(sizeof(*wpt_tmp),1);
- if (wpt_tmp == NULL) {
- fatal(MYNAME ": cannot allocate memory\n");
- }
+ wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
wpt_tmp->position.altitude.altitude_meters = alt;
- wpt_tmp->shortname = strdup(name);
- wpt_tmp->description = strdup(desc);
+ wpt_tmp->shortname = xstrdup(name);
+ wpt_tmp->description = xstrdup(desc);
wpt_tmp->creation_time = time(NULL);
if (latdir == 'S') lat = -lat;
wpt_tmp->position.longitude.degrees = ilon + (lon - ilon)*(100.0/60.0);
ilat = (int)(lat);
wpt_tmp->position.latitude.degrees = ilat + (lat - ilat) * (100.0/60.0);
- wpt_tmp->icon_descr = strdup(icon);
+ wpt_tmp->icon_descr = xstrdup(icon);
waypt_add(wpt_tmp);
}
{
const char **avp = &attrv[0];
- wpt_tmp = calloc(sizeof(*wpt_tmp), 1);
- if (wpt_tmp == NULL) {
- fatal(MYNAME ": allocate memory\n");
- }
+ wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
while (*avp) {
if (strcmp(avp[0], "lat") == 0) {
static void
gpx_cdata(void *dta, const XML_Char *s, int len)
{
- char *foo = malloc(len+1);
+ char *foo = xmalloc(len+1);
foo[len] = 0;
strncpy(foo, s, len);
if (in_name && in_wpt) {
static void
wr_init(const char *fname)
{
- HxWFile = calloc(GM100_WPO_FILE_SIZE, 1);
- if (HxWFile == NULL)
- {
- fatal("GPSBABEL: Cannot alloc memory\n");
- }
+ HxWFile = xcalloc(GM100_WPO_FILE_SIZE, 1);
- strcpy (fOutname,fname);
+ strcpy (fOutname,fname);
}
struct tm *ptm;
- HxWpt = calloc(GM100_WPO_FILE_SIZE, 1);
- if (HxWpt == NULL)
- {
- fatal("GPSBABEL: Cannot alloc memory\n");
- }
+ HxWpt = xcalloc(GM100_WPO_FILE_SIZE, 1);
/* read the wpo file to the data-array */
iDataRead = fread( HxWpt, 1, GM100_WPO_FILE_SIZE, file_in );
/* Get the waypoints */
for (iCount = 0; iCount < iWptNum ; iCount ++)
{
- wpt_tmp = calloc(sizeof(*wpt_tmp), 1);
+ wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
iWptIndex = ((WPTHDR *)HxWpt)->idx[iCount]; /* get the waypoint index */
dwIndex= OFFS_WPT + (sizeof(WPT) * iWptIndex);
strncpy(desc,pWptHxTmp->comment,sizeof(pWptHxTmp->comment));
desc[sizeof(pWptHxTmp->comment)]=0;
- wpt_tmp->shortname = strdup(name);
- wpt_tmp->description = strdup(desc);
+ wpt_tmp->shortname = xstrdup(name);
+ wpt_tmp->description = xstrdup(desc);
wpt_tmp->creation_time = 0;
if (pWptHxTmp->date.year)
char *vdata;
struct tm tm = {0};
- wpt_tmp = calloc(sizeof(*wpt_tmp),1);
- if (wpt_tmp == NULL) {
- fatal(MYNAME ": cannot allocate memory\n");
- }
-
+ wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
rec = (struct record *) pdb_rec->data;
wpt_tmp->position.altitude.altitude_meters = pdb_read4(&rec->elevation);
vdata = (char *) pdb_rec->data + sizeof(*rec);
- wpt_tmp->shortname = strdup(vdata);
+ wpt_tmp->shortname = xstrdup(vdata);
vdata += strlen (vdata) + 1;
- wpt_tmp->description = strdup(vdata);
+ wpt_tmp->description = xstrdup(vdata);
vdata += strlen (vdata) + 1;
tm.tm_sec = pdb_read2(&rec->crt_sec);
static int ct;
struct tm *tm;
abort();
- rec = calloc(sizeof(*rec),1);
+ rec = xcalloc(sizeof(*rec),1);
#if 0
strncpy(rec->ID, wpt->shortname, sizeof(rec->ID));
rec->ID[sizeof(rec->ID)-1] = 0;
struct tm tm;
waypoint *waypt;
- waypt = calloc(sizeof *waypt, 1);
- if (waypt == NULL)
- return NULL;
+ waypt = xcalloc(sizeof *waypt, 1);
printf("%s\n", trkmsg);
memset(&tm, 0, sizeof(tm));
descr[0] = 0;
icon_token[0] = 0;
- waypt = calloc(sizeof *waypt, 1);
- if (waypt == NULL)
- fatal(MYNAME ": Cannot allocate memory\n");
+ waypt = xcalloc(sizeof *waypt, 1);
sscanf(trkmsg,"$PMGNWPL,%lf,%c,%lf,%c,%d,%c,%[^,],%[^,]",
&latdeg,&latdir,
waypt->position.longitude.degrees = mag2degrees(lngdeg);
waypt->position.altitude.altitude_meters = alt;
- waypt->shortname = strdup(shortname);
- waypt->description = strdup(descr);
+ waypt->shortname = xstrdup(shortname);
+ waypt->description = xstrdup(descr);
waypt->icon_descr = mag_find_descr_from_token(icon_token);
return waypt;
my_fread4(&wpt_count, mapsend_file_in);
while (wpt_count--) {
- wpt_tmp = calloc(sizeof(*wpt_tmp), 1);
+ wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
fread(&scount, sizeof(scount), 1, mapsend_file_in);
fread(tbuf, scount, 1, mapsend_file_in);
my_fread8(&wpt_long, mapsend_file_in);
my_fread8(&wpt_lat, mapsend_file_in);
- wpt_tmp->shortname = strdup(name);
- wpt_tmp->description = strdup(comment);
+ wpt_tmp->shortname = xstrdup(name);
+ wpt_tmp->description = xstrdup(comment);
wpt_tmp->position.altitude.altitude_meters = wpt_alt;
wpt_tmp->position.latitude.degrees = -wpt_lat;
wpt_tmp->position.longitude.degrees = wpt_long;
sscanf(ibuf,
"Waypoint %s %s %s %c%d %f %c%d %f %d %s Symbol & Name %s",
name, date, timeb, &latdir, &latd, &latf, &londir, &lond, &lonf, &alt, altunits, icon);
- wpt_tmp = calloc(sizeof(*wpt_tmp),1);
- if (wpt_tmp == NULL) {
- fatal("MAPSOURCE: cannot allocate memory\n");
- }
+ wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
/* FIXME: Implement actual appropriate conversion */
wpt_tmp->position.altitude.altitude_meters = alt * 3.0;
- wpt_tmp->shortname = strdup(name);
- wpt_tmp->description = strdup(name);
+ wpt_tmp->shortname = xstrdup(name);
+ wpt_tmp->description = xstrdup(name);
lat = latd + latf/100.0;
lon = lond + lonf/100.0;
*/
for (l = strlen(istring); l > start; l--) {
if (strchr(vowels, istring[l-1])) {
- char *ostring = strdup(istring);
+ char *ostring = xstrdup(istring);
strncpy(&ostring[l-1], &istring[l], 1+strlen(istring)-l);
ostring[strlen(istring)-1] = 0;
if (s == NULL) {
badchars = DEFAULT_BADCHARS;
} else {
- badchars = strdup(s);
+ badchars = xstrdup(s);
}
}
char *
mkshort(const char *istring)
{
- char *ostring = strdup(istring);
+ char *ostring = xstrdup(istring);
char *nstring;
char *tstring;
char *cp;
char *np;
int i, l, nlen, replaced;
-
- if (!ostring) {
- fatal("mkshort: could not reallocate memory for string\n");
- }
-
/*
* Whack leading "[Tt]he",
*/
if (( strlen(ostring) > target_len + 4) &&
(strncmp(ostring, "The ", 4) == 0 ||
strncmp(ostring, "the ", 4) == 0)) {
- nstring = strdup(ostring + 4);
- if (!nstring) {
- fatal(needmem);
- }
+ nstring = xstrdup(ostring + 4);
free(ostring);
ostring = nstring;
}
* Look at the back of the string for " by BLAH" and whack
* it there.
*/
- nstring = strdup(ostring);
+ nstring = xstrdup(ostring);
l = strlen (nstring);
while (l > 0) {
if (strncmp(&nstring[l], " by ",4) == 0) {
/*
* Eliminate Whitespace
*/
- tstring = strdup(ostring);
- if (!tstring) {
- abort();
- }
+ tstring = xstrdup(ostring);
l = strlen (tstring);
cp = ostring;
for (i=0;i<l;i++) {
/*
* Eliminate chars on the blacklist.
*/
- tstring = strdup(ostring);
- if (!tstring) {
- fatal(needmem);
- }
+ tstring = xstrdup(ostring);
l = strlen (tstring);
cp = ostring;
for (i=0;i<l;i++) {
* both.
*/
- tstring = strdup(ostring);
- if (!tstring) {
- fatal(needmem);
- }
+ tstring = xstrdup(ostring);
/*
* Delete vowels starting from the end. If it fits, quit stomping
if (strlen(buff)) {
- wpt_tmp = calloc(sizeof(*wpt_tmp), 1);
-
- if (wpt_tmp == NULL) {
- fatal(MYNAME ": cannot allocate memory\n");
- }
+ wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
/* data delimited by commas, possibly enclosed in quotes. */
s = buff;
wpt_tmp->position.longitude.degrees = atof(s);
break;
case 2:
- wpt_tmp->description = strdup(s);
- if (! wpt_tmp->description)
- fatal(MYNAME, ": cannot allocate memory\n");
-
+ wpt_tmp->description = xstrdup(s);
wpt_tmp->description = csv_stringtrim(wpt_tmp->description, "");
break;
case 3:
- wpt_tmp->shortname = strdup(s);
- if (! wpt_tmp->shortname)
- fatal(MYNAME, ": cannot allocate memory\n");
-
+ wpt_tmp->shortname = xstrdup(s);
csv_stringtrim(wpt_tmp->shortname, "");
break;
case 4:
if ((strlen(buff)) && (strstr(buff, ",") != NULL)) {
- wpt_tmp = calloc(sizeof(*wpt_tmp), 1);
-
- if (wpt_tmp == NULL) {
- fatal(MYNAME ": cannot allocate memory\n");
- }
+ wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
/* data delimited by commas, possibly enclosed in quotes. */
s = buff;
break;
case 1:
/* waypoint name */
- wpt_tmp->shortname = strdup(s);
-
- if (! wpt_tmp->shortname)
- fatal(MYNAME, ": cannot allocate memory\n");
-
+ wpt_tmp->shortname = xstrdup(s);
csv_stringtrim(wpt_tmp->shortname, "");
break;
case 2:
break;
case 10:
/* Description */
- wpt_tmp->description = strdup(s);
-
- if (! wpt_tmp->description)
- fatal(MYNAME, ": cannot allocate memory\n");
-
+ wpt_tmp->description = xstrdup(s);
wpt_tmp->description = csv_stringtrim(wpt_tmp->description, "");
break;
sscanf(ibuf, "W %s %c%lf %c%lf %s %s %ld %90[^\n']",
name, &latdir, &lat, &londir, &lon,
date, time, &alt, desc);
- wpt_tmp = calloc(sizeof(*wpt_tmp), 1);
+ wpt_tmp = xcalloc(sizeof(*wpt_tmp), 1);
wpt_tmp->position.altitude.altitude_meters = alt;
- wpt_tmp->shortname = strdup(name);
- wpt_tmp->description = strdup(desc);
+ wpt_tmp->shortname = xstrdup(name);
+ wpt_tmp->description = xstrdup(desc);
if (latdir == 'S') lat = -lat;
if (londir == 'W') lon = -lon;
wpt_tmp->position.longitude.degrees = lon/100.0;
wpt_tmp->position.latitude.degrees = lat/100.0;
- wpt_tmp->icon_descr = strdup(icon);
+ wpt_tmp->icon_descr = xstrdup(icon);
waypt_add(wpt_tmp);
}
}
pincount = *(short int *)&buff[12];
while (pincount--) {
- wpt_tmp = calloc(sizeof(*wpt_tmp),1);
-
- if (wpt_tmp == NULL) {
- fatal(MYNAME ": cannot allocate memory\n");
- }
+ wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
/* things we will probably never know about this waypoint */
/* coming from a pushpin file. */
buffer_washer(buff, stringsize);
- wpt_tmp->shortname = strdup(buff);
+ wpt_tmp->shortname = xstrdup(buff);
/* 1 bytes string size */
psp_fread(&buff[0], 1, 1, psp_file_in);
buffer_washer(buff, stringsize);
- wpt_tmp->description = strdup(buff);
+ wpt_tmp->description = xstrdup(buff);
/* 1 bytes - string size */
psp_fread(&buff[0], 1, 1, psp_file_in);
while( fscanf(file_in, "%s %le%c %le%c %ld%c %30[^,] %c",
name, &lat, &latdir, &lon, &londir,
&alt, &alttype, desc, icon) > 0) {
- wpt_tmp = calloc(sizeof(*wpt_tmp),1);
- if (wpt_tmp == NULL) {
- fatal(MYNAME ": cannot allocate memory\n");
- }
+ wpt_tmp = xcalloc(sizeof(*wpt_tmp),1);
wpt_tmp->position.altitude.altitude_meters = alt;
- wpt_tmp->shortname = strdup(name);
- wpt_tmp->description = strdup(desc);
+ wpt_tmp->shortname = xstrdup(name);
+ wpt_tmp->description = xstrdup(desc);
wpt_tmp->creation_time = time(NULL);
if (latdir == 'S') lat = -lat;
if (londir == 'W') lon = -lon;
wpt_tmp->position.longitude.degrees = lon/100.0;
wpt_tmp->position.latitude.degrees = lat/100.0;
- wpt_tmp->icon_descr = strdup(icon);
+ wpt_tmp->icon_descr = xstrdup(icon);
waypt_add(wpt_tmp);
}
#include <stdio.h>
#include <stdlib.h>
+void *
+xmalloc(size_t size)
+{
+ void *obj = malloc(size);
+
+ if (!obj) {
+ fatal("gpsbabel: Unable to allocate %d bytes of memory.\n");
+ }
+
+ return obj;
+}
+
+void *
+xcalloc(size_t nmemb, size_t size)
+{
+ void *obj = calloc(nmemb, size);
+
+ if (!obj) {
+ fatal("gpsbabel: Unable to allocate %d bytes of memory.\n");
+ }
+
+ return obj;
+}
+
+char *
+xstrdup(const char *s)
+{
+ char *o = strdup(s);
+
+ if (!o) {
+ fatal("gpsbabel: Unable to allocate %d bytes of memory.\n");
+ }
+
+ return o;
+}
+
+
coord
mkposn(const char *string)
{